﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>管理系统 | 登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- ================== BEGIN core-css ================== -->
    <link href="~/css/google/googleapis/css.css" rel="stylesheet" />
    <link href="~/css/google/googleapis/icon.css" rel="stylesheet" />
    <link href="~/css/google/app.min.css" asp-append-version="true" rel="stylesheet" />
    <!-- ================== END core-css ================== -->
    <link href="~/plugins/gritter/css/jquery.gritter.css" asp-append-version="true" rel="stylesheet" />
</head>
<body class="pace-top">
    <!-- begin #page-loader -->
    <div id="page-loader" class="fade show">
        <span class="spinner"></span>
    </div>
    <!-- end #page-loader -->
    <!-- begin #page-container -->
    <div id="page-container" class="page-container fade page-sidebar-fixed page-with-wide-sidebar page-with-light-sidebar">
        <!-- begin login -->
        <div class="login login-v1">
            <!-- begin login-container -->
            <div class="login-container">
                <!-- begin login-header -->
                <div class="login-header">
                    <div class="brand">
                        <span class="logo">
                            <span class="text-blue">内</span>
                            <span class="text-red">部</span>
                            <span class="text-orange">系</span>
                            <span class="text-blue">统</span>
                        </span> <b>登录</b>
                        <small>...</small>
                    </div>
                    <div class="icon">
                        <i class="fa fa-lock"></i>
                    </div>
                </div>
                <!-- end login-header -->
                <!-- begin login-body -->
                <div class="login-body">
                    <!-- begin login-content -->
                    <div class="login-content">
                        <form id="form-login" asp-action="Index" class="margin-bottom-0">
                            <div class="form-group m-b-20">
                                <input type="text" name="UserName" class="form-control form-control-lg inverse-mode" placeholder="用户名" data-parsley-required="true" data-parsley-minlength="2" />
                                <!--data-parsley-required-message="确认密码不可为空"-->
                            </div>
                            <div class="form-group m-b-20">
                                <input type="password" name="Password" class="form-control form-control-lg inverse-mode" placeholder="密码" data-parsley-required="true" data-parsley-minlength="6"/>
                            </div>
                            <div class="login-buttons">
                                <input id="form-login-button" type="button" class="btn btn-primary btn-block btn-lg" value="登录" />
                            </div>
                        </form>
                    </div>
                    <!-- end login-content -->
                </div>
                <!-- end login-body -->
            </div>
            <!-- end login-container -->
        </div>
        <!-- end login -->
    </div>

    <!-- ================== BEGIN core-js ================== -->
    <script src="~/js/app.min.js"></script>
    <script src="~/js/theme/google.min.js"></script>
    <!-- ================== END core-js ================== -->
    <script src="~/plugins/gritter/js/jquery.gritter.js"></script>
    <script src="~/js/ext.js" asp-append-version="true"></script>
    <script src="~/plugins/parsleyjs/dist/parsley.min.js"></script>
    <script src="~/plugins/parsleyjs/dist/i18n/zh_cn.extra.js"></script>
    <script src="~/plugins/parsleyjs/dist/i18n/zh_cn.js"></script>
    <script>

        var login = function () {
            if (!$('#form-login').parsley().validate()) return;
            $.ajax({
                type: "POST",
                dataType: "json",
                //contentType: "application/json; charset=UTF-8",
                url: "@Url.Action("Index", "Login")",
                data: $("#form-login").serialize(),
                success: function (result) {
                    if (result.Success) {
                        window.location.href = "/";
                    } else {
                        show_alert('warning', result.Message)
                    }
                },
                error: function (e) {
                    show_alert('error', '网络异常.')
                }
            });
        }
        $(document).ready(function () {
            $("#form-login-button").click(function () {
                login();
            });
            $('input[name="Password"]').keydown(function (event) {
                if (event.keyCode == 13) {
                    login();
                }
            });
        });

    </script>
</body>
</html>
